import { ElMessage } from 'element-plus';

const localstorage = {
    get: function(key) {
        const value = window.localStorage.getItem(key);
        return !value ? null : JSON.parse(value);
    },
    set: function (key, value) {
        window.localStorage.setItem(key, JSON.stringify(value));
    },
    remove: function(key) {
        window.localStorage.removeItem(key);
    }
}

const pathMap = {
    login: "登录",
    brand: '品牌管理',
    leveltype: '车辆类型管理',
    pricetype: '价格区间管理',
    enterprise: '企业管理',
    blackusers: '黑名单管理',
    user: '用户管理'
}

const url = {
    login: 'login',
    brand: 'brand',
    levelType: 'leveltype',
    pricetype: 'Pricetype',
    enterprie: 'enterprie'
}

const alert = {
    success: (msg) => {
        ElMessage.success(msg);
    },
    error: (msg) => {
        ElMessage.error(msg);
    },
    warn: (msg) => {
        ElMessage.warning(msg);
    }
}

export {
    localstorage,
    pathMap,
    alert,
    url
}
